<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE html>
<html>
<head>
    <jsp:include page="/WEB-INF/jsp/include/head.jsp"/>
</head>
<body>

<ol class="breadcrumb">
    <li><strong>当前位置： </strong>标准化管理</li>
    <li class="active">通知管理</li>
</ol>

<div class="panel panel-info">
    <div class="panel-heading">
        <h3 style="display: inline-block" class="panel-title">查询</h3>
        <a role="button" id="btn_add" style="float: right" class="btn btn-default btn-xs btn-info"
           href="javaScript:;"><span
                class="glyphicon glyphicon-plus-sign"></span> 添 加</a>
    </div>
    <div class="panel-body">
        <form id="form_search" class="form-horizontal row">

            <div class="form-group col-sm-4">
                <label class="col-sm-5  control-label  ">类　　型：</label>
                <div class="col-sm-7">
                    <select class="form-control" name="noticeType">
                        <option value="">&nbsp;</option>
                        <option value="generalAnnouncement">一般公告</option>
                        <option value="generalNotice">一般通知</option>
                        <option value="trainingNotice">培训通知</option>
                    </select>
                </div>
            </div>


            <div class="form-group col-sm-6">
                <label class="col-sm-3  control-label  ">发布日期：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <div class="input-group date form_date timeInput">
                       <span class="input-group-addon">
                          <span class="glyphicon glyphicon-calendar"></span>
                       </span>
                            <input class="form-control " type="text" name="startTime">
                        </div>
                        <span class="input-group-addon"
                              style="width: auto;padding-right: 3px;padding-left: 3px;border-width: 0px;background-color: transparent">
                          <span>~</span>
                       </span>
                        <div class="input-group date form_date timeInput">
                       <span class="input-group-addon">
                          <span class="glyphicon glyphicon-calendar"></span>
                       </span>
                            <input class="form-control " type="text" name="endTime">
                        </div>
                    </div>
                </div>
            </div>


            <div class="form-group col-sm-2">
                <div class="col-sm-12">
                    <button id="btn_search" type="button" class="btn btn-default "><span
                            class="glyphicon glyphicon-search"></span>&nbsp;查&nbsp;询&nbsp;</button>
                </div>
            </div>
        </form>

    </div>
</div>


<table id="table_data"></table>


<div class="modal fade" id="modal_ajax">
    <div class="modal-dialog  modal-lg ">
        <div class="modal-content ">
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->


<jsp:include page="/WEB-INF/jsp/include/footer.jsp"/>


<script>
    var $table_data = $('#table_data');
    $("#btn_search").click(function () {
        $table_data.bootstrapTable('refresh');
    });
    $table_data.bootstrapTable({
        url: 'notice/noticeInfoManager/select',
        striped: true,
        cache: false,
        sidePagination: 'server',
        pageSize: 10,
        pageList: [10, 20, 30, 40, 50, 100],
        pageNumber: 1,
        pagination: true,
        queryParams: function (params) {
            $.extend(params, $("#form_search").serializeObject());
             return params
        },
        columns: [
            {
                formatter: function (value, row, index) {
                    return index + 1
                }
            }, {
                field: 'name',
                title: '标题'

            }, {
                field: 'noticeType',
                title: '类型',
                formatter: function (value, row, index) {
                    return [
                        $.sysPlugin.ifElse(value, {
                            "generalAnnouncement": "一般公告",
                            "generalNotice": "一般通知",
                            "trainingNotice": "培训通知"
                        })
                    ].join('');
                }
            },

            {
                field: 'accountName',
                title: '发布人'

            }, {
                field: 'releaseTime',
                title: '发布时间',
                formatter: function (value, row, index) {
                    return [
                        $.Helper.dataTimeHelper.int2DateTimeString(value)
                    ].join('');
                }
            },
            {
                title: '发布对象',
                events: 'operateEvents',
                formatter: function (value, row, index) {
                    return [
                        '<button id="button"  class="btn btn-default btn-xs   publishObject">',
                        '<span class="glyphicon glyphicon-screenshot" aria-hidden="true"></span> 查 看</button>'
                    ].join('');
                }
            },

            {
                title: '发布内容',
                events: 'operateEvents',
                formatter: function (value, row, index) {
                    return [
                        '<a href="notice/noticeInfoManager/detail?id='+row.id+'" style="text-decoration: none ;">详细</a>'
                    ].join('');
                }
            }
        ]
    });


    window.operateEvents = {

        'click .publishObject': function (e, value, row, index) {
            $('#modal_ajax').modal({
                backdrop: 'static',
                keyboard: false,
                show: true,
                remote: 'notice/noticeInfoManager/publishObject?id='+row.id
            });
        }
    };


    $("#btn_add").click(function () {
        $('#modal_ajax').modal({
            backdrop: 'static',
            keyboard: false,
            show: true,
            remote: 'notice/noticeInfoManager/editDlg'
        });
    });

    $.sysPlugin.clearModalRemoveData("modal_ajax");
    $.sysPlugin.initDateTimeInput();
    $.sysPlugin.initSimpleSelect2();
</script>
</body>
</html>
